package com.tueye.dao.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.tueye.base.util.BaseDao;
import com.tueye.base.util.IBaseHbnDao;
import com.tueye.base.util.Page;
import com.tueye.dao.IAdinfoDao;
import com.tueye.dao.IAdsiteDao;
import com.tueye.entity.Adinfo;
import com.tueye.entity.Admin;
import com.tueye.entity.Adsite;
/**
 * 
 * @author hanxiaowei
 *
 */
@Scope("prototype")
@Component("adinfoDao")
public class AdinfoDaoImpl extends BaseDao implements IAdinfoDao{
	
	@Autowired
	@Qualifier("baseHbnDao")
	private IBaseHbnDao  baseHbnDao;

	@Override
	public Page pagedQueryByHQL(String hql, int pageNo, int pageSize,
			Object... values) {
		return baseHbnDao.pagedQueryByHQL(hql, pageNo, pageSize, values);
	}
	@Override
	public void addAdinfo(Adinfo adinfo){
		baseHbnDao.saveOrUpdate(adinfo);
		
	}
	@Override
	public void delAdinfo(String id) {
		Adinfo adinfo =  (Adinfo) baseHbnDao.findById(Adinfo.class, id);
		baseHbnDao.delete(adinfo);
	}
	@Override
	public Adinfo getAdinfoById(String id) {
		return (Adinfo) baseHbnDao.findById(Adinfo.class, id);
	}
	@Override
	public Adinfo getAdinfoByHql(String hql) {
		// TODO Auto-generated method stub
		return (Adinfo) baseHbnDao.queryList(hql);
	}

}
